"use strict";
cc._RF.push(module, '2fabaUelYFBBJBfdd2kGzZo', 'WeaponHammer');
// scripts/WeaponHammer.js

"use strict";

var t = require;
var e = module;
var o = exports;

var _i,
    n = void 0 && (void 0).__extends || (_i = function i(t, e) {
  return (_i = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _i(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    a = void 0 && (void 0).__decorate || function (t, e, o, i) {
  var n,
      a = arguments.length,
      r = a < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);else for (var s = t.length - 1; s >= 0; s--) {
    (n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
  }
  return a > 3 && r && Object.defineProperty(e, o, r), r;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});

var r = t("GameConstant"),
    s = t("Util"),
    l = cc._decorator,
    c = l.ccclass,
    d = l.property,
    h = function (t) {
  function e() {
    var e = null !== t && t.apply(this, arguments) || this;
    return e.node_anim = null, e.collider = null, e.pfb_star = null, e.isGameOver = !1, e.damageNum = 0, e.bMoving = !1, e.curAniAngle = 360, e.bCanAttack = !0, e;
  }

  return n(e, t), e.prototype.init = function (t, e, o, i) {
    this.collider.tag = e, this.damageNum = o, this._carTag = t, t == r.Collide_Car_Tag.Left ? (this.node.scaleX = 1, this.node.position = i) : (this.node.scaleX = -1, this.node.position = cc.v3(-i.x, i.y, i.z));
  }, e.prototype.playAnimation = function (t) {
    t && (this.curAniAngle = -this.curAniAngle), this.bMoving = !0, cc.tween(this.node_anim).by(s.Util.attackSpeed(1, this._carTag), {
      angle: this.curAniAngle
    }).repeatForever().start();
  }, e.prototype.stopAnimation = function () {
    this.bMoving = !1, this.node_anim.stopAllActions();
  }, e.prototype.playEffect = function () {
    this.isGameOver;
  }, e.prototype.onGameStart = function () {}, e.prototype.onGameOver = function () {
    this.isGameOver = !0, this.stopAnimation();
  }, e.prototype.onGameBoutReady = function () {
    this.node.active = !1, this.bMoving = !1, this.destroy();
  }, e.prototype.onGameBoutStart = function () {
    this.isGameOver = !1, this.bMoving = !1, this.node.active = !0, this.playAnimation();
  }, e.prototype.onGameBoutOver = function () {
    this.isGameOver = !0, this.bMoving = !1, this.stopAnimation();
  }, e.prototype.onCanAttack = function (t) {
    this.bCanAttack = t, t ? this.playAnimation() : this.stopAnimation();
  }, e.prototype.getDamage = function () {
    var t = this;
    return this.bMoving ? (this.stopAnimation(), this.scheduleOnce(function () {
      t.playAnimation(!0);
    }, s.Util.attackSpeed(.5, this._carTag)), s.Util.vibrateMiddle(), this.damageNum) : 0;
  }, a([d(cc.Node)], e.prototype, "node_anim", void 0), a([d(cc.Collider)], e.prototype, "collider", void 0), a([d(cc.Prefab)], e.prototype, "pfb_star", void 0), a([c], e);
}(cc.Component);

o["default"] = h;

cc._RF.pop();